package com.leetcode.LC;

public class LC461_2 {
    public int hammingDistance(int x, int y) {
        return Integer.bitCount(x ^ y);
    }

    public int hammingDistance_2(int x, int y) {
        int z = x ^ y;
        int count = 0;
        while (z != 0) {
            count++;
            z = (z - 1) & z;
        }
        return count;
    }
}
